package com.wondertek.poms.core.filter.impl;

import com.wondertek.poms.core.filter.BaseRuleFilter;
import com.wondertek.poms.core.filter.RuleFilterChain;
import com.wondertek.poms.dao.po.Content;
import com.wondertek.poms.dao.po.IRulePo;
import com.wondertek.poms.dao.po.PcProductRule;
import com.wondertek.poms.dao.po.PrdInfoRule;


/**
 * <p><b>CopyRightCpIdFilter Description:</b> 版权所属CP过滤器</p>
 * @author douzi
 * <b>DATE</b> 2019年9月27日 下午4:00:58
 */
public class CopyRightCpIdFilter extends BaseRuleFilter {

	@Override
	public void doFilter(IRulePo rule, Content c, RuleFilterChain chain) {
		if (rule instanceof PrdInfoRule) {
			PrdInfoRule r = (PrdInfoRule) rule;
			this.baseFilter(r.getPrdRuleId(),
					r.getCopyRightCpId() == null ? null : r.getCopyRightCpId() + "",
					c.getCopyrightCpid(),
					chain,
					"版权所属CP-CopyrightCpid");
		}else if(rule instanceof PcProductRule){
			PcProductRule r= (PcProductRule) rule;
			this.baseFilter(r.getId(),
					r.getCopyrightCpid()!=null?r.getCopyrightCpid():"",
					c.getCopyrightCpid(),
					chain,
					"版权所属CP-CopyrightCpid");
		}

		chain.doFilter(rule, c, chain);
	}

}
